﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ChangeProblem.Logic
{
    public class ChangeProblem1
    {
        public int[] GetChange(decimal change, decimal[] nominalvalue)
        {
            
            int[] changePlan = new int[nominalvalue.Length];

            for (int i = 0; i < nominalvalue.Length; i++)
            {
                changePlan[i] = (int)(change / nominalvalue[i]);
                change -= changePlan[i] * nominalvalue[i];
            }

            return changePlan;
        }

        public decimal ChangeAmount(double price, double payment)
        {
            return (decimal)(payment - price);
        }
    }
}
